<template>
  <div>
    <el-form :inline="true" :model="editData">
      <el-row :gutter="12">
        <el-col :span="12">
          <el-form-item label="包名">
            <el-input v-model="editData.packName" placeholder="包名"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="方法名">
            <el-input
              v-model="editData.methodName"
              placeholder="方法名"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="submit-buttom">
      <el-button-group>
        <el-button type="primary" @click="saveLogSetBtn">保存</el-button>
        <el-button type="primary" @click="celBtn">取消</el-button>
      </el-button-group>
    </div>
  </div>
</template>

<script setup>
import { reactive, toRef, onMounted, getCurrentInstance } from 'vue';
const { proxy } = getCurrentInstance();
const props = defineProps({
  isShow: { type: Boolean, default: false },
  editData: { type: Object, default: {} },
});
const emits = defineEmits(['update:isShow', 'querySysLogSet']);
const editData = toRef(props, 'editData');
const celBtn = () => {
  emits('update:isShow', false);
};
const saveLogSetBtn = async () => {
  proxy.$api.system.saveSysLogSet(editData.value).then(res => {
    if (res.code != -1) {
      proxy.$message({
        type: 'success',
        message: res.msg,
      });
      props.isShow = false;
      emit('querySysLogSet');
    } else {
      // 关闭对话框
      proxy.$message({
        type: 'success',
        message: res,
      });
    }
  });
};
</script>
<style lang="scss" scoped>
.submit-buttom {
  text-align: right;
  padding-top: 7vh;
  padding-right: 5vh;
}
</style>
